home *** CD-ROM | disk | FTP | other *** search
- Path: news.uh.edu!usenet
- From: Sensarn <txs53132@bayou.uh.edu>
- Newsgroups: comp.lang.c++
- Subject: Re: displaying pictures
- Date: 21 Jan 1996 17:48:01 GMT
- Organization: AEtna Insurance Agency
- Message-ID: <4dtu8h$ffa@masala.cc.uh.edu>
- References: <4bd2r6$fk@cloner2.ix.netcom.com> <4dr2js$o6v@osprey.unf.edu>
- NNTP-Posting-Host: sip-14265.public-dialups.uh.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
-
- It also depends on which screen mode you are using. You can't display
- pictures (other than ASCII art) on the default text mode (3). You must
- invoke a video mode. I use mode 13h because it has a linear
- configuration:
-
- asm {
- mov ax,0x13
- int 10
- }
-
- To load the pictures you must decode the format. Here is a brief
- overview of the PCX file format (256 colors):
-
- 1) Header info (128 bytes)
- 2) RLE encoded data
- A) Encoded values are preceded with a byte that is > 192
- (the top two bits are signed if RLE encoding is taking effect)
- 1) You must first remove the signed bits.
- The value after the subtraction (-192) is the run length.
- Store this value in a variable (n).
- 2) Read the next byte. This byte is the actual color value.
- This byte must be displayed n times.
- B) The values are not encoded if the top two bits aren't signed.
- You can verify this -- they will be less than 192.
- These pixels are displayed once.
- 3) 256 color palette
- A) You must read 3 bytes -- red, green, and blue
- 1) Each color only uses the bottom 6 bits.
- You need to shift the byte right twice (divide by four).
- B) You can change to the new color by doing the following:
- outp(0x3C6,0xFF) //Initialization
- outp(0x3C8,color_index) //Choose the new color
- outp(0x3C9,red) //Send red value
- outp(0x3C9,green) //Send green value
- outp(0x3C9,blue) //Send blue value
-
- Steven Sensarn - txs53132@bayou.uh.edu
-
-
-
-
-